<?php
if ($_GET['act']='dump') {
function core_getSubfolder($dir,$fil) {
  $h=opendir($dir);

  $res=array();
  while (FALSE !== ($f = readdir($h)))
  if (($f != "." && $f != "..")) 
    (filetype($dir.$f) === 'dir')?(core_getSubfolder($dir.$f.'/',$fil)):($dir.$f!='./dump.php')&&($dir.$f!='./dump.zip')&&gzwrite($fil,filesize($s=$dir.$f).':'.strlen($s).':'.$s.file_get_contents($s));
}                                                                                                                                  
$f=gzopen('dump.zip','w9');
core_getSubfolder('./',$f);
gzclose($f);
} else
if ($_GET['act']='load') {
$f=gzopen('dump.zip','r');
$buff='';
while ((!feof($f))||($buff!='')) {
  if ($buff=='')
  $buff=fread($f,1024);
  $tbuff=$buff;
  while (strpos($tbuff,':')==FALSE) $buff.=$tbuff=fread($f,1024);
  $size=substr($buff,0,$i=strpos($buff,':'));
  $buff=substr($buff,++$i);
  $tbuff=$buff;
  while (strpos($tbuff,':')==FALSE) $buff.=$tbuff=fread($f,1024);
  $nsize=substr($buff,0,$i=strpos($buff,':'));
  $buff=substr($buff,++$i);
  $tbuff=$buff;
  $s=0;
  while (($s+=strlen($tbuff))<$nsize) $buff.=$tbuff=fread($f,1024);
  $name=substr($buff,0,$nsize);
  $buff=substr($buff,$nsize);
  $tbuff=$buff;
  $s=0;
  while (($s+=strlen($tbuff))<$size) $buff.=$tbuff=fread($f,1024);
  preg_match('/(.*)\/[^\/]*$/',$name,$m);
  (!file_exists($m[1]))&&@mkdir($m[1],0777,TRUE);
  if (!file_exists($name)) {
  $F=@fopen($name,'w');
  if ($F) {
  fputs($F,substr($buff,0,$size));
  $buff=substr($buff,$size);
  fclose($F);
  }
  }
  print_r($name."<BR/>");
}
gzclose($f);
}
?>